package cn.funeralobjects.util.executor;

import cn.funeralobjects.util.factory.GlobalTreadFactory;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 用于全局线程的执行器
 *
 * @author FuneralObjects
 * Create date: 2020/4/16 3:03 PM
 */
public class GlobalPoolExecutor extends ThreadPoolExecutor {

    public GlobalPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, GlobalTreadFactory.getInstance());
    }

    public GlobalPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, RejectedExecutionHandler handler) {
        super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, GlobalTreadFactory.getInstance(), handler);
    }
}
